<template>
	<div>
		<el-button  size="small" v-for="(item, index) in listArr" :key="index" :type="currentStyle(index)" @click="changeSelected(index)">{{item}}</el-button>
	</div>
</template>
<script>
	export default {
		props: {
			listArr: Array,
			defaultActive: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				defalutValue: this.defaultActive || 0 ,
			}
		},
		methods: {
			currentStyle(value) {
				return value === this.defalutValue ? 'primary' : 'default'
			},
			changeSelected(index) {
				this.defalutValue = index
				this.$emit('getCurrentIndex', index)
			},
		}
	}
</script>
<style lang="scss">
	
</style>